#ifndef YUV_STREAM
#define YUV_STREAM
#include<queue>
typedef unsigned char uchar;
using namespace std;
#include <sys/types.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <mutex>
#include <thread>
#include <string>
#include <iostream>
#include <cstring>
#include <arpa/inet.h>
#include <netdb.h>
#include <chrono>
#include <queue>
#include <vector>
struct YuvBuffer
{
    std::time_t collectTime;  //数据采集时间戳
    std::time_t decodeTime;//数据解码时间戳
    uchar* y,* u,* v;
    int ySize,uSize,vSize;
    YuvBuffer(int ySize,int uSize,int vSize):ySize(ySize),uSize(uSize),vSize(vSize){
        y = new uchar[ySize];
        u = new uchar[uSize];
        v = new uchar[vSize];
    }
    ~YuvBuffer(){
        delete[] y;
        delete[] u;
        delete[] v;
    }
};


class YUVStream{
public:
    YUVStream();
    ~YUVStream();
public:
    void Push(YuvBuffer* yuvbuffer);
    YuvBuffer* Front();
    void Pop();
    void Clear();
    int Size();
public:
    queue<YuvBuffer*> yuvbuffers;
    int size;
    mutex queueMutex;
};



#endif
